<!--
/** Tag Cloud */
		/**
		 * Reload tag cloud of group.
		 */
		function reloadTagCloud(){
		 	DWRGroupManager.getBackgroundGroupTagCloud(showTagCloud);
	 	}
	 	
		/**
		 * Visualize tag cloud of group.
		 */
		function showTagCloud(tagCloud){
		 	if(tagCloud != null && tagCloud.html != ""){
		 		$('bigtagcloud').update(tagCloud.html);
	 		}
	 	}
		


		/** Renaming functions */
   		var groupNameField;
   		var newGroupName;
	  	function showGroupTextfield(){
	  		groupNameField = $("groupNameField").innerHTML;
	  		$("groupNameField").update();
	  		$("groupNameField").update("<input ID=\"groupNameTextfield\" type=\"text\" size=\"60\" name=\"Group name\" value=\"" + groupNameField + "\"/>");
	  		toggleRename1();
	  	}
	  	/**
   		* Toggles the visibility of the Group-RenameButtons
   		* @param ID of the ResourceVisualization
   		*/
   		function toggleRename1(){ 
   			$('groupRenameButton').setStyle({display:'none'});
   			$('groupSaveRenameButton').setStyle({display:'inline'});
		} 
		function toggleRename2(){ 
			$('groupRenameButton').setStyle({display:'inline'});
   			$('groupSaveRenameButton').setStyle({display:'none'});
		} 
		function saveNewGroupName(groupID){
	  		newGroupName = $F("groupNameTextfield");
	  		$("groupNameField").update(newGroupName);
	  		DWRUserManager.renameGroup(groupID, newGroupName, saveNewGroupDetailsCallback);
	  		toggleRename2();
	  	}
		function saveNewGroupDetailsCallback(success){
			if (!success){
   				alert('Your session has expired.');
   				window.location.reload();
   				return;
   			}
		}
	  	/** Description editing functions */
	  	var groupDescriptionField;
   		var newGroupDescription;
	  	function editGroupDescription(){
	  		groupDescriptionField = $("groupDescriptionField").innerHTML;
	  		$("groupDescriptionField").update('');
	  		$("groupDescriptionField").update("<input ID=\"groupDescriptionTextfield\" type=\"text\" size=\"60\" name=\"Group description\" value=\"" + groupDescriptionField + "\"/>");
	  		toggleEditDescription1();
	  	}
	  	/**
   		* Toggles the visibility of the Group-RenameButtons
   		* @param ID of the ResourceVisualization
   		*/
   		function toggleEditDescription1(){ 
   			$('editDescriptionButton').setStyle({display:'none'});
   			$('groupSaveDescriptionButton').setStyle({display:'inline'});
		} 
		function toggleEditDescription2(){ 
			$('editDescriptionButton').setStyle({display:'inline'});
   			$('groupSaveDescriptionButton').setStyle({display:'none'});
		} 
		function saveNewGroupDescription(groupID){
	  		newGroupDescription = $F("groupDescriptionTextfield");
	  		$("groupDescriptionField").innerHTML = newGroupDescription;
	  		DWRUserManager.editGroupDescription(groupID, newGroupDescription, saveNewGroupDetailsCallback);
	  		toggleEditDescription2();
	  	}
	  	
   		/**
   		* Finds and saves the position and the size of a ResourceVisualization.
   		* @param elementID the ID of the ResourceVisualitation to save
   		*/
   		function saveResourcePos(elementID, contentID){  
   			var layer = null;  
   			var content = null;
   			layer = dwr.util.byId(elementID);  
   			content = dwr.util.byId(contentID);  
   			updateResourceVisualizationsProperties(contentID, layer.offsetLeft, layer.offsetTop, layer.offsetWidth, layer.offsetHeight, $(layer).getStyle('zIndex') ,$('group').offsetWidth, $('group').offsetHeight);
   		}

   		/**
   		* Updates the position and size of a ResourceVisualization by calling the GroupManager.
   		* @param resVisuID the ID of the ResourceVisualization to save
   		* @param posX the X-position of the ResourceVisualization to save
   		* @param posY the Y-position of the ResourceVisualization to save
   		* @param resWidth the width of the ResourceVisualization to save
   		* @param groupWidth the width of the current group
   		*/
   		function updateResourceVisualizationsProperties(resVisuID, posX, posY, resWidth, resHeight, zAxis, groupWidth, groupHeight){
   			DWRGroupManager.updateResourceVisualization(resVisuID, posX, posY, resWidth, resHeight, zAxis, groupWidth, groupHeight, updateResourceVisualizationCallback);
   		}
   		
   		
   		function updateResourceVisualizationCallback(success){
   			if (!success){
   				alert('Your session has expired.');
				window.location.reload();
				return;
   			}
   		}
   		/** BEGIN: GROUP TAGS **/
   		
   		/**
   		* Callback function for reloadGroupTags.
 		* @param tagsArray array of all Tags for this Resource as HtmlFormattedElements
   		*/
   		function showGroupTags(tagsArray){
   			$("groupTags").update(createTagString(tagsArray));
   		}
   		
   		/**
   		* Called by the group menu to add a Tag to the actual group.
   		*/
 		function addTagToGroup(){
   			var tagForGroup = $F("addTagToGroupField");
   			if (tagForGroup=="" || tagForGroup=="Please enter a Tag"){
   			dwr.util.setValue("addTagToGroupField", "Please enter a Tag");
   			}
   			else if(checkTagKeyword(tagForGroup, "/") || checkTagKeyword(tagForGroup, "\\") || checkTagKeyword(tagForGroup, "?")){
   				dwr.util.setValue("addTagToGroupField", "Please enter a Tag");
   				alert("Tags may not contain /, ?, \\");
   			}
   			else if (tagForGroup!=null && tagForGroup!=""){
   				DWRGroupManager.addTagToActualGroup(tagForGroup, addTagToGroupCallback);
   				$('addTagToGroupField').clear();
   			}
   			
   		}

   		/**
   		* Called by the group menu to add a Tag to the actual group.
   		*/
   		function addTagToGroupCallback(success){
   			if (success) {
   				reloadTagCloud();
   				return;
   			}
   			else {
   				alert('Your session has expired.');
   				window.location.reload();
   				return;
   			}
   		}
   		
   		/**
   		 * Checks wether the keyword contains the given character
   		 */
   		function checkTagKeyword(keyword, character){
   			if(keyword.indexOf(character) == -1){
   				return false;
   			}
   			else{ 
   				return true;
   			}
   		}
   		
   		/** END: GROUP TAGS **/
   		
   		/**
   		* Removes a ResourceVisualization from the GroupVisulization.
   		* @param the ID of the ResourceVisualization to remove.
   		*/
   		function removeResourceFromGroup(resVisuID){
   		tmpResVisuID = resVisuID;
   		DWRGroupManager.getResourceName(resVisuID, removeResourceFromGroupCallback);
   		}

   		function removeResourceFromGroupCallback(resVisuName){
   			removeCheck = confirm("Do you really want to remove Resource: " + resVisuName + " from Group: " + $('groupNameField').innerHTML + "?");
   			if (removeCheck == false) return;
   			$('group').removeChild(dwr.util.byId(tmpResVisuID + "_border"));
   			DWRGroupManager.removeResourceFromGroup(tmpResVisuID, removeResourceFromGroupCallback2);
   		}
   		
   		function removeResourceFromGroupCallback2(success){
   			if (!success){
   				alert('Your session has expired.');
   				window.location.reload();
   				return;
   			}
   		}
   		
   		function previewResource(){
			var url = $F("urlinput");
			if(url.substr(0, 7) != "http://") {
				url = "http://" + url;
			}
			$('resource_preview').src = url;
			parent.frames[resource_preview].window.location.reload();
		}

		function addResourceToGroup() {
			var description = $F("descriptioninput").replace(/\n/g,"<br>");
		    var	titel = $F("titelinput");
			var	urlinput = $F("urlinput");
			hs.closeAll();
			DWRResourceAggregation.addResourceManual(urlinput, titel, description, loadResourceIntoGroup);
	   	}
		//-->